## Title
Bluepill STM32F103 MCU

![Bluepill STM32F103 development board](../../Images/bluepill_module.jpg)

![Bluepill STM32F103 course pinout overview](../../Images/bluepill_pinout_course.svg)

## What It Is
The Bluepill is a small development board built around an STMicroelectronics `STM32F103` ARM Cortex-M3 microcontroller. In this course, it is the main brain of the system.

## What It Does In This Project
- runs the course firmware
- talks to sensors and displays
- responds to USB and Bluetooth commands
- manages timers, GPIO, PWM, and communication buses

## Origins And Background
The STM32 family comes from STMicroelectronics. It became very popular because it offered a lot of capability for a low cost. The Bluepill board became well known in hobby and education circles because it made ARM microcontrollers cheap and accessible.

## How It Communicates
- `UART` for HC-05 serial communication
- `I2C` for devices like the MPU6050
- `SPI` for devices like the MAX7219
- `USB CDC` for the browser dashboard serial connection
- GPIO pins for direct digital input and output

## Course Pinout
These are the main Bluepill connections used in the course hardware:

- `PA4` : `MAX7219 CS`
- `PA5` : `MAX7219 SCK`
- `PA7` : `MAX7219 MOSI`
- `PA8` : `WS2812 RGB matrix data` using `TIM1_CH1`
- `PA2` : `HC-05 TX` line on `USART2`
- `PA3` : `HC-05 RX` line on `USART2`
- `PB10` : `I2C2 SCL` for `MPU6050` and `SSD1306 OLED`
- `PB11` : `I2C2 SDA` for `MPU6050` and `SSD1306 OLED`
- `PB1` : `MPU6050 INT`
- `PB4` : `HC-SR04 TRIG`
- `PB0` : `HC-SR04 ECHO`
- `PA11` : `USB D-`
- `PA12` : `USB D+`

This is a good note to keep beside the bench, because the Bluepill is where all the separate device notes come together.

## Physical Layer Notes
The MCU sends and receives electrical signals on pins. Some pins are simple on/off digital lines. Others are shared buses with timing rules and special modes.

## Why It Matters
This board shows students that a microcontroller is not just “a tiny computer”. It is a computer designed to interact directly with real hardware.

## Teaching Focus
- microcontroller vs full computer
- firmware in flash, working data in RAM
- pins, peripherals, and datasheets
- the idea of one chip talking to many devices

## Datasheet Navigation Tips
When using the STM32 datasheet or reference manual, look for:
- pinout tables
- memory sizes
- electrical limits
- timer features
- communication peripheral sections

## Interesting Detail
The same STM32 chip can blink LEDs, read sensors, talk USB, run timers, and generate PWM all at once because it contains dedicated hardware peripherals for each job.

## Good Questions To Ask Students
- Why is a microcontroller better than a full PC for a small robot or gadget?
- Why do we care about which pins can do UART, SPI, or I2C?
- Why does the datasheet matter before wiring something up?
